package com.appcheck.recording.monitors;

import java.util.Timer;

import android.app.Activity;
import android.app.Instrumentation;
import android.content.IntentFilter;

import com.appcheck.recording.listener.impl.OrientationDetector;

public class ActivityChangedMonitor{
	
	private Instrumentation instrumentation;
  	private Instrumentation.ActivityMonitor activityMonitor;
  	private Activity activity;
  	private OrientationDetector mOrientationDetector;
  	
  	public Instrumentation getInstrumentation() {
  		return instrumentation;
	}
	
	public void setInstrumentation(Instrumentation instrumentation) {
		this.instrumentation = instrumentation;
	}
	
	public Instrumentation.ActivityMonitor getActivityMonitor() {
		return activityMonitor;
	}
	
	public void setActivityMonitor(Instrumentation.ActivityMonitor activityMonitor) {
		this.activityMonitor = activityMonitor;
	}
	
	public Activity getActivity() {
		return activity;
	}
	
	public void setActivity(Activity activity) {
		this.activity = activity;
	}

	public ActivityChangedMonitor(Instrumentation instrumentation){
		this.activityMonitor = instrumentation.addMonitor((IntentFilter)null, null, false);
    	this.instrumentation = instrumentation;
	}

	public final OrientationDetector getmOrientationDetector() {
		return mOrientationDetector;
	}

	public final void setmOrientationDetector(OrientationDetector mOrientationDetector) {
		this.mOrientationDetector = mOrientationDetector;
	}

	public void launch(){
		new Timer().schedule(new ActivityChangedTask(this), 200L, 200L);
	}
}